---
title: "api_not_found"
description: "The requested API was not found"
---

<Danger>
err:unkey:data:api_not_found
</Danger>


```json Example
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "error": {
    "detail": "The requested API could not be found",
    "status": 404,
    "title": "Not Found",
    "type": "https://unkey.com/docs/api-reference/errors-v2/unkey/data/api_not_found"
  }
}
```

## What Happened?

This error occurs when you're trying to perform an operation on an API that doesn't exist in the Unkey system. In Unkey, APIs are resources that you create to organize and manage your keys.

Common scenarios that trigger this error:
- Using an incorrect API ID in your requests
- Referencing an API that has been deleted
- Attempting to access an API in a workspace you don't have access to
- Typos in API names when using name-based lookups

Here's an example of a request that would trigger this error:

```bash
# Attempting to create a key for a non-existent API
curl -X POST https://api.unkey.com/v2/keys.createKey \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer unkey_YOUR_API_KEY" \
  -d '{
    "apiId": "api_nonexistent",
    "name": "hello world"
  }'
```

## How To Fix

Verify that you're using the correct API ID and that the API still exists in your workspace:

1. List all APIs in your workspace to find the correct ID
2. Check if the API has been deleted and recreate it if necessary
3. Verify you're working in the correct workspace
4. Ensure proper permissions to access the API

Here's how to list all APIs in your workspace:

```bash
curl -X POST https://api.unkey.com/v2/apis.listApis \
  -H "Authorization: Bearer unkey_YOUR_API_KEY"
```

If you need to create a new API, use the `apis.createApi` endpoint:

```bash
curl -X POST https://api.unkey.com/v2/apis.createApi \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer unkey_YOUR_API_KEY" \
  -d '{
    "name": "My New API"
  }'
```

## Common Mistakes

- **Copy-paste errors**: Using incorrect API IDs from documentation examples
- **Deleted APIs**: Attempting to reference APIs that have been deleted
- **Environment confusion**: Looking for an API in production that only exists in development
- **Workspace boundaries**: Trying to access an API that exists in another workspace

## Related Errors
- [err:unkey:data:workspace_not_found](./workspace_not_found) - When the requested workspace doesn't exist
- [err:unkey:data:key_not_found](./key_not_found) - When the requested key doesn't exist
- [err:unkey:authorization:insufficient_permissions](../authorization/insufficient_permissions) - When you don't have permission to access an API
